using System;
using System.Collections.Generic;
using System.Diagnostics;
using NUnit.Framework;

namespace mebc3
{
    [TestFixture]
    public class BoardWeavingMoreGeneric
    {
        [Test]
        public void Run()
        {
            var b = new Stage();
            var p = new FuncStage<string, string>(x => x + "x");

            b.OutputPins.Add(Console.WriteLine);
            p.OutputPins.Add(b.OutputPins[0]);
            b.InputPins.Add(p.InputPins[0]);

            b.InputPins[0]("b");
        }

    }


    public class Stage
    {
        public List<Action<object>> InputPins = new List<Action<object>>();
        public List<Action<object>> OutputPins = new List<Action<object>>();
    }


    public class FuncStage<TIn, TOut> : Stage
    {
        public FuncStage(Func<TIn, TOut> func)
        {
            InputPins.Add(x => OutputPins[0](func((TIn)x)));
        }
    }
}